<!DOCTYPE html>
<html>
<head>
    <title>基础数据导入</title>
<#include "../common/common.ftl"/>
</head>
<body style="overflow-y: hidden;">
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header">基础数据：</div>
        <div class="layui-card-body">
            <form class="layui-form" id="arrayForm">
                <div class="layui-form-item">
                    <label class="layui-form-label">项目名称：</label>
                    <div class="layui-inline layui-hide-xs">
                        <select name="zsProjectId" id="zsProjectSelect">
                            <option value="">--请选择--</option>
                        </select>
                    </div>
                </div>
                <textarea class="layui-textarea" cols="150" rows="13" name="contractArray"
                          lay-verify="required" style="resize:none;background-color:  #FFFFE0;"></textarea>
                <button class="layui-btn layui-btn-fluid"
                        style="margin-top: 10px;" lay-submit="" lay-filter="submit">立即导入
                </button>
            </form>
        </div>
    </div>

    <div class="layui-card">
        <div class="layui-card-header">数据导入说明</div>
        <div class="layui-card-body" style="color: red;">
            1、请按照下方图片所示红色框线内数据粘贴到上方文本框内，并确认数据正确性；【红色为必填】<br/>
            2、数据格式： 所在工作组、协议编号、被动迁人、身份证号、联系电话、产权调换面积、可限量照顾购买安置部分、可限量增加安置部分、低保户照顾购买、居住困难户保障安置、未建合法宅基地照顾购买、房屋倒塌或只有房屋基础照顾购买、企业照顾购买、选房顺序号、腾空日期(yyyy-MM-dd)、每月应发周转过渡费、每月装修过渡补助费、征收补偿协议中应缴交金额；<br/>
            3、导入期间请耐心等待，勿进行其他操作。
            <img src="/images/contractImport.png" style="max-width: 100%;"/>
        </div>
    </div>
</div>
<script src="/layui/layui.js" charset="utf-8"></script>
<script>
    layui.config({
        base: '/modules/' //静态资源所在路径
    }).use(['form', 'dataDict'], function () {
        var $ = layui.jquery, form = layui.form, dataDict = layui.dataDict,
                parentIndex = parent.layer.getFrameIndex(window.name);
        dataDict.zsProject("zsProjectSelect", "");

        //监听提交
        form.on('submit(submit)', function (data) {
            $.ajax({
                url: 'importAll',
                type: 'post',
                data: $("#arrayForm").serialize(),
                async: false,
                success: function (data) {
                    if (data.code == "0001") {
                        layer.alert(data.message, function (index) {
                            parent.layer.close(parentIndex);
                        });
                        parent.loadData();
                    } else {
                        layer.msg(data.message, {anim: 6, icon: 2, time: 3000});
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>